import { GBox } from "../../../../../com/mui/containers/GBox";
import { ChatTimeItem } from "./ChatTimeItem";
import { GBoxDirection } from "../../../../../com/mui/containers/globalVariable/GBoxDirection";
import { ChatItem } from "../chatPanel/ChatItem";
import { Vector } from "../../../../../__AS3__/vec/Vector";
type int = number;
//class ChatPrivatePanel
    
    export  class ChatPrivatePanel extends GBox
    {
        constructor(arg1: int=30)
        {
            super();
            this._maxItem = arg1;
            this._spMessageVector = new Vector.<ChatTimeItem>();
            super.direction = GBoxDirection.VERTICAL;
            super.verticalGap = 6;
            return;
        }

        public addChatItem(arg1: ChatItem, arg2: string, arg3: Date, arg4: string=""): void
        {
            var loc1=new ChatTimeItem(arg1, arg2, arg3, arg4);
            this.addChild(loc1);
            this._spMessageVector.push(loc1);
            if (this._spMessageVector.length > this._maxItem) 
            {
                loc1 = this._spMessageVector.shift();
                this.removeChild(loc1);
                loc1.dispose();
            }
            this.validateNow();
            return;
        }

        public /* override */ validateNow(): void
        {
            updateDisplayList();
            super.validateNow();
            return;
        }

        public /* override */ get height(): number
        {
            var loc4=null;
            var loc5=0;
            var loc6=null;
            var loc1=0;
            var loc2=0;
            var loc3=this._spMessageVector.length;
            while (loc2 < loc3) 
            {
                loc6 = this._spMessageVector[loc2];
                loc1 = loc1 + loc6.height;
                ++loc2;
            }
            return loc1 + 10 + verticalGap * (this._spMessageVector.length - 1);
        }

        public reset(): void
        {
            this._spMessageVector = new Vector.<ChatTimeItem>();
            var loc1=(this.numChildren - 1);
            while (loc1 >= 0) 
            {
                this.removeChildAt(loc1);
                --loc1;
            }
            return;
        }

        /* internal */ /* var */_spMessageVector: Vector.<ChatTimeItem>;

        /* internal */ /* var */_maxItem: int;
    }
